@model IEnumerable<TimeManager.Domain.Entities.Task>
@{
    ViewBag.Title = "Tasks";
}
<h2>@ViewBag.Title</h2>
<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table>
    <tr>
        <th>
            Actions
        </th>
        <th>
            Description
        </th>
        <th>
            TimeStart
        </th>
        <th>
            Duration
        </th>
        <th>
            User
        </th>
        <th>
            Project
        </th>
    </tr>
    @foreach (var item in Model) {
        <tr>
            <td>
                @Html.ActionLink("Edit", "Edit", new { id = item.TaskId }) |
                @Html.ActionLink("Details", "Details", new { id = item.TaskId }) |
                @Html.ActionLink("Delete", "Delete", new { id = item.TaskId })
            </td>
            <td>
                @item.Description
            </td>
            <td>
                @String.Format("{0:g}", item.TimeStart)
            </td>
            <td>
                @item.Duration
            </td>
            <td>
                @(item.User == null ? "None" : item.User.Name)
            </td>
            <td>
                @(item.Project == null ? "None" : item.Project.Name)
            </td>
        </tr>
    }
</table>
